package com.xcity.game.rank.impl;

import java.util.Comparator;

import com.xcity.db.entity.Player;
import com.xcity.db.entity.Ranking;
import com.xcity.game.event.GameEvents;
import com.xcity.game.rank.BaseRankingList;
import com.xcity.game.worldboss.WorldBossUtils;

import naga.x.event.Event;

/**
 * 世界boss积分排行榜
 * @author yang.li
 *
 */
public class WorldBossRankingList extends BaseRankingList {

	public WorldBossRankingList(int type, int capacity, Comparator<Ranking> comparator) {
		super(type, capacity, comparator);
	}

	@Override
	public int[] getEventTypes() {
		return new int[] { GameEvents.EVENT_WORLD_BOSS_COMBAT_END };
	}

	@Override
	public void handleEvent(Event event) {
		Player player = event.getParameter(0);
		int score = WorldBossUtils.getScore(player);
		if (score > 0) {
			setDirty(player, score);
		}
	}

}
